<!-- @format -->

<template>
  <div :v-loading="true" class="ma-content-block p-4" style="height:calc(100vh - 110px)">

    <div class="flex flex_column" style="height:100%">
      <a-space size="medium" :fill="true">
        <a-button v-for="(item, index) in prediciont_statusList.value" :key="index"
          :type="item.key == prediciont_status ? 'primary' : 'secondary'"
          @click="handleprediciont_status(item.key, 1)">{{ item.title }}</a-button>
      </a-space>
      <div style="margin-bottom: 12px"></div>
      <ma-crud :options="options" :columns="columns" @row-click="rowClick"  ref="crudRef" @selection-change="setSelectedKeys">
        <template #tableBeforeButtons>
            <a-button type="primary"  @click="handleChongGouAdd" v-auth="['prediction:manage:save']">新增</a-button>
            <a-button type="primary"  @click="handelShowUp"
          v-auth="['prediction:manage:importBat']" >批量新增</a-button>
            <!-- <a-button type="primary" @click="handlePipei">匹配客户</a-button> -->
            <a-button type="primary" @click="onepipeiShow = true" v-auth="['prediction:manage:save']">匹配客户（逐条）</a-button>
            <a-button type="primary" @click="handleDaozhan" v-auth="['prediction:manage:index']">确认到站</a-button>
            <a-button type="primary" @click="handleZhuangxie" v-auth="['prediction:manage:index']">下发装卸</a-button>
            <a-button type="primary" @click="setFdsl(tab)" v-auth="['prediction:order:blth']">办理提货</a-button>
            <!-- <a-button type="primary" @click="setFdcc(tab)" v-auth="['prediction:order:blth']">仓储入库</a-button> -->
            <a-button type="primary" @click="showRunDeta = true" v-auth="['prediction:Tz:eryueshuju']">跑数据</a-button>

            
            <a-popconfirm content="是否删除所选数据?" @ok="plDelete">
              <a-button type="primary" v-auth="['prediction:manage:delete']">删除</a-button>
            </a-popconfirm>
        </template>
        <template #dept_id="{ record }">
                <a-tooltip :content="record.dept?.name">
                  <div v-if="record.dept">{{ record.dept?.name }}</div>
                </a-tooltip>
                <div style="color:red;" v-if="!record.dept && record.is_nobody == 1">无主货</div>
                <div v-else></div>
        </template>
        <template #contract_id="{ record }">{{ record.contract_no }}</template>
        <template #goods_id="{ record }">{{ record.goods_name }}</template>
        <template #ticket_number="{ record }">{{ record.ticket_numbers || record.ticket_numbers }}</template>
        
        <template #car_no="{ record }">
          <a-tooltip :content="record.car_type  + ' ' + record.car_no">
            <div>{{ record.car_type?record.car_type + ' ':''}}{{record.car_no}}</div>
          </a-tooltip>
          <a-tooltip :content="record.boxs">
            <div v-if="record.box != ''">{{ record.boxs}}</div>
          </a-tooltip>
        </template>
        <template #producer="{ record }">
          <a-tooltip :content="record.fzs?.name  + ' ' + record.dzs?.name">
            <div>{{ record.fzs?.name || ''}}{{' ' + record.dzs?.name}}</div>
          </a-tooltip>
        </template>
        <template #number="{ record }">
          <div>{{ record.numbers }}件</div>
          <div>{{ record.weights.toFixed(3) }}吨</div> 
        </template>
        <template #operationBeforeExtend="{ record }" >
          <div style="display:flex;flex-wrap:wrap;" @click.stop>
            <!-- <a-link @click="handlexiugaiFW(record)" v-if="record.prediciont_status != 1 && record.prediciont_status != 6 && record.prediciont_status != 0">修改是否仓储</a-link> -->
            <a-link @click="handlecaozuoMb(record)">操作面板</a-link>
            <!--  -->
            <a-link @click="handleRuyuan(record)" v-if='record.load == 3 && record.prediciont_status != 0' v-auth="['prediction:manage:fbzx']">发布装卸任务</a-link>
            <!-- <a-link @click="handleXiugaiweight(record)" v-if="record.prediciont_status != 0">修改计费重量</a-link> -->
            <!-- <a-link v-if="record.prediction_pay_status == 0 && record.prediciont_status == 0" @click="handleEdit(record)">编辑</a-link> -->
            <!-- && record.prediciont_status != 2   v-auth="['financial:payOrder:index']" -->
            <a-link @click="handleQueRenZhangdan(record)" v-if="record.cost_order_count != 0 || record.pay_order_count != 0" >待确认账单({{ record.pay_order_count }}  {{record.cost_order_count}})</a-link>
            <!-- && record.prediciont_status != 2 -->
            <a-link @click="handleZhangdan(record)" v-if="record.is_compled != 0 " v-auth="['financial:payOrder:index']">账单</a-link>
            <a-link @click="openFile(record.ticket_numbers)" >大票</a-link>
            <a-link @click="openTuoyun(record)" v-if="record.prediction_pay_status != 0 " >托运单</a-link>
            <a-link @click="handlecopy(record)">复制</a-link>
            <!-- <a-link @click="openPaiSong(record)" v-if="record.prediciont_status == 1 && (record.service_type == 2 || record.service_type == 4) " >打印派送单</a-link>
            <a-link @click="opentiHuo(record)" v-if="record.prediciont_status == 1 && (record.service_type == 1 || record.service_type == 3) " >打印装车单</a-link> -->
            <a-popconfirm content="是否删除此条信息?" v-if="record.prediciont_status == 0 && record.is_nobody == 0 && record.is_compled == 0" @ok="handleDel(record)">
              <a-link status="danger" v-auth="['prediction:manage:delete']">删除</a-link>
            </a-popconfirm>
          </div>
        </template>
        <!-- <template #summaryCell="{ record,column }">
          {{ column.dataIndex == 'yundanhao' ? '总计' 
          : column.dataIndex == 'number_yu'? record[column.dataIndex]
          : column.dataIndex == 'hz_weight'? (record[column.dataIndex] - 0).toFixed(3)
          : column.dataIndex == 'bz_weight'? (record[column.dataIndex] - 0).toFixed(3)
          : column.dataIndex == 'jf_weight'? (record[column.dataIndex] - 0).toFixed(3)
          : column.dataIndex == 'cyr_weight'? (record[column.dataIndex] - 0).toFixed(3)
          : column.dataIndex == 'number'? (record.numbers - 0) + '/' + (record.weights - 0).toFixed(3)
          : ''}}
        </template> -->
        <template #summaryCell="{ record,column }">
          {{ column.dataIndex == 'yundanhao' ? '总计' 
          : column.dataIndex == 'number_yu'? itemTotal?.number
          : column.dataIndex == 'hz_weight'? itemTotal?.hz_weight
          : column.dataIndex == 'bz_weight'? itemTotal?.bz_weight
          : column.dataIndex == 'jf_weight'? itemTotal?.jf_weight
          : column.dataIndex == 'cyr_weight'? itemTotal?.cyr_weight
          : ''}}
        </template>
        
      </ma-crud>
    </div>


    <!-- 装卸任务 -->
    <a-modal :mask-closable="false"  v-model:visible="ruyuanShow" title="装卸任务" @cancel="handleruyuanShow" :width="1000" :on-before-ok="handleTJyuyuan"
      v-if="ruyuanShow">
      <a-form :model="rowData">
        <a-row :gutter="16">
          <a-col :span="24">
            <a-form-item field="name" label="公司名称" label-col-flex="80px">
              <a-input v-model="rowData.dept_name" disabled placeholder="请输入公司名称" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="24">
            <a-form-item field="batch_no" label="原始凭证" label-col-flex="80px">
              <a-input v-model="rowData.batch_no" disabled placeholder="请输入原始凭证" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="24">
            <a-form-item field="car_no" label="车号" label-col-flex="80px">
              <a-input v-model="rowData.car_no" disabled placeholder="请输入车号" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="24">
            <a-form-item field="work_line" label="作业线路" label-col-flex="80px">
              <a-input v-model="rowData.work_line" placeholder="请输入作业线路" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="24">
            <a-form-item field="transport_number" label="车厢位置" label-col-flex="80px">
              <a-input v-model="rowData.transport_number" placeholder="请输入车厢位置" />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-modal>

    <!-- 编辑弹窗 -->
    <a-modal :mask-closable="false"  v-model:visible="editShow" title="编辑" @cancel="handleeditShow" :width="1000" :on-before-ok="handleTJedit" v-if="editShow">
      <a-form :model="rowData">
        <a-row :gutter="16">
          <a-col :span="8">
            <a-form-item field="name" label="公司名称" label-col-flex="80px">
              <a-input v-model="rowData.dept_name"  placeholder="请输入公司名称" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="contract_no" label="合同号" label-col-flex="80px">
              <a-input v-model="rowData.contract_no"  placeholder="请输入合同号" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="goods_name" label="品名" label-col-flex="80px">
              <a-input v-model="rowData.goods_name"  placeholder="请输入品名" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="8">
            <a-form-item field="serve_type" label="是否仓储" label-col-flex="80px">
              <a-select v-model="rowData.serve_type" placeholder="请选择" allow-clear>
                <a-option :value="items.key" v-for="(items, indexs) in fuwuList.value" :key="indexs">{{ items.title
                  }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="car_type" label="车种" label-col-flex="80px">
              <a-input v-model="rowData.car_type" placeholder="请输入车种" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="car_no" label="车号" label-col-flex="80px">
              <a-input v-model="rowData.car_no" placeholder="请输入车号" />
            </a-form-item>
          </a-col>
          
        </a-row>
        <a-row :gutter="16">
          <a-col :span="8">
            <a-form-item field="number" label="数量（件）" label-col-flex="80px">
              <a-input v-model="rowData.number_yu" placeholder="请输入数量" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="hz_weight" label="货重（吨）" label-col-flex="80px">
              <a-input v-model="rowData.hz_weight" placeholder="请输入货重" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="bz_weight" label="标重" label-col-flex="80px">
              <a-input v-model="rowData.bz_weight" placeholder="请输入标重" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16">
          <a-col :span="8">
            <a-form-item field="jf_weight" label="计费重量" label-col-flex="80px">
              <a-input v-model="rowData.jf_weight" placeholder="请输入计费重量" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="cyr_weight" label="承运人重量" label-col-flex="80px">
              <a-input v-model="rowData.cyr_weight" placeholder="请输入承运人重量" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="ticket_number" label="原票号" label-col-flex="80px">
              <a-input v-model="rowData.ticket_number" placeholder="请输入原票号" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="16" v-if="rowData.transport_type == 1">
          <a-col :span="8">
            <a-form-item field="box_belong" label="箱属" label-col-flex="80px">
              <!-- <a-input v-model="rowData.box_belong" placeholder="请输入箱属" /> -->
              <a-select 
            v-model="rowData.box_belong" :options="belongList" 
            allow-clear allow-search placeholder="请选择箱属" />
            </a-form-item>
          </a-col>
          <a-col :span="8" v-if="rowData.transport_type == 1">
            <a-form-item field="box_type_id" label="箱型箱类" label-col-flex="80px">
              <a-select v-model="rowData.box_type_id" placeholder="请选择" allow-clear>
                <a-option :value="items.id" v-for="(items, indexs) in boxTypeList.value" :key="indexs">{{ items.name
                  }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="8" v-if="rowData.transport_type == 1">
            <a-form-item field="box" label="箱号" label-col-flex="80px">
              <a-input v-model="rowData.box" placeholder="请输入箱号" />
            </a-form-item>
          </a-col>

        </a-row>
        <a-row :gutter="16">
          
          <a-col :span="8">
            <a-form-item field="producer" label="发站" label-col-flex="80px">
              <a-input v-model="rowData.producer" placeholder="请输入发站" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="come_address" label="到站" label-col-flex="80px">
              <a-input v-model="rowData.come_address" placeholder="请输入到站" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item field="transport_type" label="运输方式" label-col-flex="80px">
              <a-select v-model="rowData.transport_type" placeholder="请选择" allow-clear>
                <a-option :value="items.key" v-for="(items, indexs) in yunshuList.value" :key="indexs">{{ items.title
                  }}</a-option>
              </a-select>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-modal>

    <!-- 新增弹窗 -->
    <a-modal :mask-closable="false"  v-model:visible="addShow" title="新增/编辑" @cancel="addShow = false" :width="1500" :footer="false"  >
      <addindex v-if="addShow" :dept_list="dept_list" :yunshuList="yunshuList.value" :item="itemData" :fuwuList="fuwuList.value" :goods_list="goods_list" @succ="handleAddSucc"></addindex>
    </a-modal>

    <!-- 修改计费重量 -->
    <a-modal :mask-closable="false"  v-model:visible="xiugaiweightShow" title="修改计费重量" @cancel="handlexiugaiweightShow" :width="1000"
    :on-before-ok="handleTJXGedit" v-if="xiugaiweightShow">
      <a-form :model="xiugaiweightItem">
        <a-form-item field="name" label="公司名称" label-col-flex="80px">
          <a-input v-model="xiugaiweightItem.dept.name" disabled placeholder="请输入公司名称" />
        </a-form-item>
        <a-form-item field="batch_no" label="原始凭证号" label-col-flex="80px">
          <a-input v-model="xiugaiweightItem.batch_no" disabled placeholder="请输入原始凭证号" />
        </a-form-item>
        <a-form-item field="car_no" label="车号" label-col-flex="80px">
          <a-input v-model="xiugaiweightItem.car_no" disabled placeholder="请输入车号" />
        </a-form-item>
        <a-form-item field="weight_yu" label="计费重量" label-col-flex="80px">
          <a-input v-model="xiugaiweightItem.weight_yu" placeholder="请输入计费重量" />
        </a-form-item>
      </a-form>
      <div class="flex justify_center" style="color:red">
        <div>提示：</div>
        <div>修改计费重量将影响以重量计费的账单费用，点击“确定”修改计费重量，您确定要修改吗。</div>
      </div>
    </a-modal>

    <!-- 修改是否仓储 -->
    <a-modal :mask-closable="false"  v-model:visible="xiugaiFWFSShow" title="修改是否仓储" @cancel="xiugaiFWFSShow = false" :on-before-ok="handleFWFSedit"
      v-if="xiugaiFWFSShow">
      <div class="flex align_center" style="margin-bottom: 24px">
        <div style="width:100px">公司名称：</div>
        <a-input v-model="fuwuItem.dept.name" disabled placeholder="请输入公司名称" />
      </div>
      <div class="flex align_center" style="margin-bottom: 24px">
        <div style="width:100px">合同名称：</div>
        <a-input v-model="fuwuItem.contract_no" disabled placeholder="请输入合同名称" />
      </div>
      <div class="flex align_center" style="margin-bottom: 24px">
        <div style="width:100px">是否仓储：</div>
        <a-select v-model="fuwuserve_type" :options="fuwuList.value" :field-names="{ value: 'key', label: 'title' }"
          allow-clear allow-search placeholder="请选择是否仓储" />
      </div>
    </a-modal>

    <!-- 导入 -->
    <a-modal :mask-closable="false"  v-model:visible="showUpload" title="导入Excel" @cancel="handleShow" :width="600" :footer="false">
      <div style="padding: 8px 10px; " v-if="showUpload">
        <a-upload :file-list="fileList" draggable :action="env.VITE_APP_OPEN_PROXY === 'true'
            ? env.VITE_APP_PROXY_PREFIX + '/prediction/manage/importBat'
            : env.VITE_APP_BASE_URL + '/prediction/manage/importBat'
          " :headers="{ Authorization: `Bearer ${token}` }" :on-before-upload="beforeUpload" :limit="1" :data="{
            // transport_type: yunshuId,
            // serve_type: fuwuId,
            // butt_type: duijieId,
            // dept_id: yonghuId,
          }" @success="handleSuccess" />
        <div style="margin-top: 12px; color: #1e80ff">
          <a-popconfirm content="是否下载模版?" @ok="downFromOther">
            <a-link>模板下载</a-link>
          </a-popconfirm>
        </div>
      </div>
    </a-modal>

    <!-- 预览预计导入的数据 -->
    <a-modal :mask-closable="false"  v-model:visible="showYuji" title="确认导入数据" @cancel="handleYujiCel" :width="1400" ok-text="确认导入"
      :footer="false">
      <a-table summary-text="合计" summary :columns="columnsEpor" row-key="id" v-model:selectedKeys="selectedKeys"
        :bordered="{ wrapper: true, cell: true }" :row-selection="{
          type: 'checkbox',
          showCheckedAll: true,
          onlyCurrent: false,
        }" :data="yujiList" @selection-change="handleSelChange" :pagination="false">
        <template #remark="{ record, rowIndex }">
          <a-tooltip :content="record.remark">
            <div style="
                color: red;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              ">
              {{ record.remark }}
            </div>
          </a-tooltip>
        </template>
        <template #service_type="{record}">
          <div>{{ record.service_type == 1?'站到站':record.service_type == 2?'站到门':record.service_type == 3?'门到站':record.service_type == 4?'门到门':''}}</div>
        </template>
        <template #transport_type="{record}">
          <div>{{ record.transport_type == 1?'集装箱':record.transport_type == 2?'整车':'批量快运'}}</div>
        </template>
        
        <template #is_empty="{ record, rowIndex }">
          <div v-if="record.transport_type == 1">{{ record.is_empty == 1 ? '空箱' : record.is_empty == 2 ? '重箱' : '' }}</div>
          <div v-else>-</div>
        </template>
        <template #box_belong="{ record, rowIndex }">
          <div v-if="record.transport_type == 1">{{ record.transport_type == 1 ? record.box_belong : '' }}</div>
          <div v-else>-</div>
        </template>
        <template #sending_station="{ record, rowIndex }">
          <div>{{ handleSend(record.sending_station) }}</div>
        </template>
        <template #come_address="{ record, rowIndex }">
          <div>{{ handleSend(record.come_address) }}</div>
        </template>
        <template #summary-cell="{ column, record, rowIndex }">
          {{
            column.dataIndex == "notice_time"
              ? "合计"
              : column.dataIndex == "bz_weight"
                ? (record[column.dataIndex] - 0).toFixed(3) + "吨"
                : column.dataIndex == "jf_weight"
                ? (record[column.dataIndex] - 0).toFixed(3) + "吨"
                : column.dataIndex == "hz_weight"
                ? (record[column.dataIndex] - 0).toFixed(3) + "吨"
                : column.dataIndex == "cyr_weight"
                ? (record[column.dataIndex] - 0).toFixed(3) + "吨"
                : column.dataIndex == "number"
                  ? record[column.dataIndex] + "件"
                  :''
          }}
        </template>
      </a-table>
      <div style="display: flex; justify-content: flex-end; margin-top: 2%">
        <a-button type="primary" @click="handleYujiSucc" :loading="yujiloading">确认导入</a-button>
      </div>
    </a-modal>

    <!-- 到站导入 -->
    <a-drawer :footer="false" :width="1400" v-model:visible="visiblestation" @cancel="handlestationCancel">
      <template #title> 到站导入 </template>
      <station ref="stationRef" @upLoadSuccess="handleStartEnd" />
    </a-drawer>
    <a-modal :mask-closable="false"  v-model:visible="visibleguoguiSL" title="办理提货" @cancel="handleYujiCel" :width="1400" ok-text="确认导入"
      :footer="false">
      <div style="height:calc(100vh - 200px);overflow:auto" v-if="visibleguoguiSL">
        <guoguiSL ref="guoguiSLRef" @handlecolse="handlecolse" :next="next" @handleNext="handleNext" />
      </div>

      <!-- </a-drawer> -->
    </a-modal>
    <!-- 仓储受理 -->
    <a-modal :mask-closable="false"  v-model:visible="visiblecangcuSL" title="仓储入库" @cancel="visiblecangcuSL = false" :width="1400"
      ok-text="确认导入" :footer="false">

      <div style="height:calc(100vh - 200px);overflow:auto">
        <cangcuSL ref="cangcuSLRef" />
      </div>
    </a-modal>

    <!-- 巡查记录 -->
    <a-drawer :footer="false" :width="1400" v-model:visible="visibleLog">
      <template #title> 巡查记录 </template>
      <logIndex ref="logRef" />
    </a-drawer>
    <!-- 账单 -->
    <a-drawer v-model:visible="orderShowItems" :footer="false" :width="1400" v-if='orderShowItems'>
      <template #title> 账单</template>
      <OrderShowItems ref="orderShowItemsRef" :info='orderShowItem' />
    </a-drawer>
    <!-- 操作面板 -->
    <a-drawer :footer="false" :width="800" v-model:visible="visiblecaozuoSL">
      <template #title> 操作面板 </template>
      <caozuoSL ref="crudRefczmb" @handleXiugai="handleXiugai" :czsjData="czsjData" :goods_list="goods_list" :tabs="tabs" v-if="visiblecaozuoSL" />
    </a-drawer>
    <!-- 匹配客户 -->
    <a-drawer :footer="false" :width="1920" v-model:visible="pipeiShow">
      <template #title> 匹配客户 </template>
      <pipeiindex ref="pipeiindexRef"  @succ="handlePipeiSucc" />
    </a-drawer>
    <!-- 逐条匹配 -->
    <a-drawer :footer="false" :width="1920" v-model:visible="onepipeiShow" @cancel="handleZhutiaoCel">
      <template #title> 匹配客户（逐条） </template>
      <onepipei v-if="onepipeiShow" :dept_list="dept_list" :yunshuList="yunshuList.value" :fuwuList="fuwuList.value" :goods_list="goods_list" />
    </a-drawer>
    <!-- 确认到站 -->
    <a-drawer :footer="false" :width="1700" v-model:visible="daozhanShow">
      <template #title> 确认到站 </template>
      <daozhanindex ref="daozhanindexRef"  @succ="handledaozhanSucc" />
    </a-drawer>
    <!-- 确认装卸 -->
    <a-drawer :footer="false" :width="1700" v-model:visible="zhuangxieShow">
      <template #title> 确认装卸 </template>
      <xiafazhuangxie ref="zhuangxieRef"  @succ="handlezhuangxieSucc" />
    </a-drawer>
    <!-- 确认账单 -->
    <a-modal :mask-closable="false"  v-model:visible="showBill" title="待确认账单" @cancel="showBill = false" :width="1600" :footer="false">
      <bill ref="billRef" v-if="showBill" :item="billData" :type="2" @quxiao="showBill = false" @shuaxin="zhangdanshuaxin"></bill>
    </a-modal>
    <!-- 打印托运单 -->
    <a-modal :mask-closable="false" 
			v-model:visible="tuoyunShow"
			width="auto"
			title="打印托运单"
			ok-text="打印"
			:footer="false"
		>
			<tuoyun :row="tuoyunList" :user="user" v-if="tuoyunShow"></tuoyun>
		</a-modal>
    <a-modal :mask-closable="false" 
			v-model:visible="showRunDeta"
			width="auto"
			title="跑数据"
			ok-text="打印"
			:footer="false"
		>
      <div>
        <a-input :style="{width:'320px'}" v-model="showRunInput" placeholder="输入页码" allow-clear />
        <div>
          <a-button type="primary" style="margin-top: 20px;" @click="handleRun">开始</a-button>
        </div>
      </div>
      
		</a-modal>
    <a-modal :mask-closable="false" 
			v-model:visible="paiSongShow"
			width="auto"
			title="打印派送单"
			ok-text="打印"
			:footer="false"
		>
			<paisong :row="paiSongList" :user="user" v-if="paiSongShow"></paisong>
		</a-modal>
		<!-- 打印装车单 -->
		<a-modal :mask-closable="false" 
			v-model:visible="tiHuoShow"
			width="auto"
			title="打印装车单"
			ok-text="打印"
			:footer="false"
		>
			<tihuo :row="tiHuoList" :user="user" v-if="tiHuoShow"></tihuo>
		</a-modal>

    <a-modal :mask-closable="false" 
			v-model:visible="dpShow"
			title="查看大票"
			:footer="false"
      width="1400px"
		>
    <div v-for="(item,index) in dpUrl" :key="index">
      <a-spin :loading="daShpwloading" tip="请稍等..." dot  style="width:100%">
        <iframe
          ref="myIframe"
          :src="item + '#zoom=100'"
          style="width: 100%; height: 800px; border: none;"
        ></iframe>
      </a-spin>
    </div>
    <div v-if="dpUrl.length == 0" >
      <a-spin :loading="true" tip="请稍等..." dot  style="width:100%">
        <div style="width: 100%; height: 800px; border: none;"></div>
      </a-spin>
    </div>
		</a-modal>

  </div>
</template>
<script setup>
import { ref, reactive, onMounted, onActivated } from "vue";
import predictionManage from "@/api/prediction/predictionManage";
import predictionAddress from "@/api/prediction/predictionAddress";
import bill from "@/components/bill/index.vue"
import paisong from "@/components/paisong/index.vue"
import tihuo from "@/components/tihuo/index.vue"
import warehouseOrder from "@/api/warehouse/warehouseOrder";
import predictionOrder from "@/api/prediction/predictionOrder";
import predictionOrderDetail from "@/api/prediction/predictionOrderDetail";
import predictionLog from "@/api/prediction/predictionLog";
import { pinyin } from "pinyin-pro"
import station from "@/views/prediction/station/index.vue";
import guoguiSL from "@/views/prediction/manage/guoguiSL.vue";
import cangcuSL from "@/views/prediction/manage/cangcuSL.vue";
import caozuoSL from "@/views/prediction/manage/caozuoMB.vue";
import pipeiindex from "@/views/prediction/manage/pipeiindex.vue";
import addindex from "@/views/prediction/manage/add.vue";
import onepipei from "@/views/prediction/manage/onepipei.vue";
import daozhanindex from "@/views/prediction/manage/daozhanindex.vue";
import xiafazhuangxie from "@/views/prediction/manage/xiafazhuangxie.vue";
import logIndex from "@/views/prediction/log/index.vue";
import OrderShowItems from "../order/orderShowItems.vue"
import commonApi from "@/api/common";
import { Message } from "@arco-design/web-vue";
import { Modal } from '@arco-design/web-vue';
import { Notification } from "@arco-design/web-vue";
import tuoyun from "@/components/tuoyun/index.vue"
import { request } from "@/utils/request.js";
import tool from "@/utils/tool";
import * as common from "@/utils/common";
import { useUserStore } from "@/store";
import { success, info, error } from "@/utils/common";
import router from "@/router";
const userStore = useUserStore();
const user = userStore.user;
const myIframe = ref(null)
const onepipeiShow = ref(false)
const showRunDeta = ref(false)
const yujiloading = ref(false)
const showRunInput = ref('')
const pipeiindexRef = ref(null)
const daozhanindexRef = ref(null)
const yundanShow = ref(false)
const showBill = ref(false)
const paiSongList = ref([])
const paiSongShow = ref(false)
const tiHuoList = ref([])
const itemData = ref({
        car_type:'',  // 车种
        car_no:'',  // 车号
        notice_time:tool.dateFormat(
          Math.round(new Date().getTime() / 1000).toString(),
          "yyyy-MM-dd hh:mm:ss"
        ),  // 通知时间
        transport_type:'1',  // 运输方式
        service_type:'',  //  服务方式
        shipper:'',   // 托运人
        shipper_agent:'',   // 托运经办人
        shipper_phone:'',   // 托运人电话
        sending_station:'',   // 发站
        sending_tlj:'',   // 发 铁路局
        sending_station_special:'',  // 发站专用线
        come_address:'',   // 到站
        come_tlj:'',   // 到 铁路局
        arrive_station_special:'四川威斯腾物流有限公司专用线',  // 到站专用线
        dept_id:'',   // 客户
        customer_handler:'',   // 客户经办人
        customer_tel:'',    // 客户电话
        contract_id:'',   // 合同
        serve_type:'3',   // 是否仓储
        shipping:'',   // 配送电话
        shipping_address:'',   // 配送地址
        goods_data:[],
})
const tiHuoShow = ref(false)
const billData = ref({})
const env = ref(import.meta.env);
const token = ref(tool.local.get(import.meta.env.VITE_APP_TOKEN_PREFIX));
const crudRef = ref(null);
const crudRefJzx = ref();
const crudRefczmb = ref();
const fileList = reactive([]);
const pick_method = ref();
const drivers = reactive([]);
const drivers_id = ref();
const visiblestation = ref(false);
const visibleguoguiSL = ref(false);
const visiblecangcuSL = ref(false);
const visiblecaozuoSL = ref(false);
const visibleLog = ref(false);
const orderShowItems = ref(false)
const orderShowItemsRef = ref();
const orderShowItem = ref()
const logRef = ref();
const stationRef = ref();
const guoguiSLRef = ref();
const cangcuSLRef = ref();
const tabs = ref('jc')
const prediciont_status = ref("");
const prediciont_statusList = reactive([]);

const rowClick = (e) => {
  if (e.prediciont_status == 0 && e.is_nobody == 0 && e.is_compled == 0) {
    if(keys.includes(e.id)){
      crudRef.value.tableSelect(e.id,false)
		}else{
			crudRef.value.tableSelect(e.id,true)
		}
  } else {
  }
  
}

const handlecopy = (e)=>{
  console.log("复制：",e)
  itemData.value = {
    car_type:(e.car_type != "" || e.car_type != null)?e.car_type + '':"",  // 车种
      car_no:(e.car_no != "" || e.car_no != null)?e.car_no + '':"",  // 车号
      notice_time:tool.dateFormat(
        Math.round(new Date().getTime() / 1000).toString(),
        "yyyy-MM-dd hh:mm:ss"
      ),  // 通知时间
      transport_type:(e.transport_type != "" && e.transport_type != null)?e.transport_type + '':"",  // 运输方式
      service_type:(e.service_type != "" && e.service_type != null)?e.service_type + '':"",  //  服务方式
      shipper:(e.shipper != "" && e.shipper != null)?e.shipper + '':"",   // 托运人
      shipper_agent:(e.shipper_agent != "" && e.shipper_agent != null)?e.shipper_agent + '':"",   // 托运经办人
      shipper_phone:(e.shipper_phone != "" && e.shipper_phone != null)?e.shipper_phone + '':"",   // 托运人电话
      sending_station:(e.sending_station != "" && e.sending_station != null)?e.sending_station - 0:"",   // 发站
      sending_tlj:(e.sending_tlj != "" && e.sending_tlj != null)?e.sending_tlj - 0:"",   // 发 铁路局
      sending_station_special:(e.sending_station_special != "" && e.sending_station_special != null)?e.sending_station_special + '':"",  // 发站专用线
      come_address:(e.come_address != "" && e.come_address != null)?e.come_address - 0:"",   // 到站
      come_tlj:(e.come_tlj != "" && e.come_tlj != null)?e.come_tlj - 0:"",   // 到 铁路局
      arrive_station_special:(e.arrive_station_special != "" && e.arrive_station_special != null)?e.arrive_station_special:'四川威斯腾物流有限公司专用线',  // 到站专用线
      dept_id:(e.dept_id != "" && e.dept_id != null && e.dept_id != 0)?e.dept_id:"",   // 客户
      customer_handler:(e.customer_handler != "" && e.customer_handler != null)?e.customer_handler + '':"",   // 客户经办人
      customer_tel:(e.customer_tel != "" && e.customer_tel != null)?e.customer_tel + '':"",    // 客户电话
      contract_id:(e.contract_id != "" && e.contract_id != null && e.contract_id != 0)?e.contract_id + "":"",   // 合同
      serve_type:(e.serve_type != "" && e.serve_type != null)?e.serve_type + '':"",   // 是否仓储
      shipping:(e.shipping != "" && e.shipping != null)?e.shipping + '':"",   // 配送电话
      shipping_address:(e.shipping_address != "" && e.shipping_address != null)?e.shipping_address + '':"",   // 配送地址
      goods_data:(e.goods_data != "" && e.goods_data != null)?e.goods_data:[]
  }
  addShow.value = true
}

// 1=先打后提,2=先提后打
const methodArr = reactive([
  { id: 1, name: "先打后提" },
  { id: 2, name: "先提后打" },
]);
const belongList = ref([
  { value: '铁路箱', lebel: "铁路箱" },
  { value: '自备箱', lebel: "自备箱" },
])
const driver_id = ref();
const showYuji = ref(false);
const tuoyunShow = ref(false)
const tuoyunList = ref([])
let tab = 1;
let ids = [];
let keys = [];
let datas = [];
let pick_type = [];
let buff_type = [];
let addresslist = [];
let yujiList = [];
const selectedKeys = ref([]);
const pick_typeid = ref();
const address_id = ref();
const buff_typeid = ref();
const xiugaiweightShow = ref(false);
const xiugaiFWFSShow = ref(false)
const fuwuItem = ref({})
const fuwuserve_type = ref()
const xiugaiweightItem = ref({});
let ccArr = [];
const czsjData = ref({})
const loadings = ref(true);
const ccid = ref(0);
const nums = ref(0);
const hengArr = ref([]);
const zongArr = ref([]);
const cengArr = ref([]);
const editShow = ref(false);
const ruyuanShow = ref(false);
let rowData = {};
const pipeiShow = ref(false)
const daozhanShow = ref(false)
const zhuangxieShow = ref(false)
const zhuangxieRef = ref(null)
const pipeiList = ref([])
const addShow = ref(false)
const sendList = ref([])
const formObj = ref({
  page: 1,
  pageSize: 10,
  dept_id: '',  // 公司
  contract_id: '',  // 合同号
  goods_ids: '',    //品名
  load: '',    // 装卸任务
  car_no: '',    // 车号
  box: '',    // 集装箱
  box_type: '',   // 集装类型
  is_car: '',    // 到站类型
  serve_type: '',   // 是否仓储
  transport_type: '',   // 运输方式
  come_time: '',   // 到达时间
  created_at: '',   // 创建时间
  prediciont_status: '',  // 状态
})

const chuliJiekou = (i) => {
	return new Promise((resolve, reject) => {
		request({
			url: "/prediction/Tz/eryueshuju",
			params: {
				page: i + 1,
				pageSize: 100,
			},	
		}).then(res=>{
      console.log(`第${i+1}页数据获取成功`)
      resolve()
    })
	}) 
}

// 跑数据
const handleRun = async ()=>{
	for(let i = 0;i<showRunInput.value;i++){
		await chuliJiekou(i)
	}
}


const openPaiSong = (item) =>{ // 打印派送单
  console.log(item)
  item.detail.map((v,i)=>{
    if(v.prediction_id == 0){
      v.prediction = v.wareuserdetail
    }
  })
  paiSongList.value = item
  paiSongShow.value = true
}
const opentiHuo = (item) =>{ // 打印提货单
  item.detail.map((v,i)=>{
    if(v.prediction_id == 0){
      v.prediction = v.wareuserdetail
    }
  })
  tiHuoList.value = item
  tiHuoShow.value = true
}


const handleSend = (id)=>{
  let name = ''
  sendList.value.map((v,i)=>{
    if(v.id == id){
      name = v.name
    }
  })
  return name
}
const openTuoyun = (row) =>{
  console.log(row)
  let tuData = JSON.parse(JSON.stringify(row))
  if(tuData.goods_data != null){
        if (typeof tuData.goods_data === 'object' && Array.isArray(tuData.goods_data)) {
          
        } else if (typeof tuData.goods_data === 'object' && !Array.isArray(tuData.goods_data)) {
          tuData.goods_data = [tuData.goods_data];
        }
    }
    if(tuData.goods_data.length == 1){
      tuData.goods_data.push({
            goods_id:'',  
            baozhuang:'',  
            box:'',  
            is_empty:'',
            box_belong:'',
            box_type:'',  
            box_type_id:'',    
            number_yu:'',  
            hz_weight:'',  
            bz_weight:'',  
            jf_weight:'',  
            cyr_weight:'', 
            size:'',
      },{
            goods_id:'',  
            baozhuang:'',  
            box:'',  
            is_empty:'',
            box_belong:'',
            box_type:'',  
            box_type_id:'',    
            number_yu:'',  
            hz_weight:'',  
            bz_weight:'',  
            jf_weight:'',  
            cyr_weight:'', 
            size:'',
      })
    }else if(tuData.goods_data.length == 2){
      tuData.goods_data.push({
        goods_id:'',  
            baozhuang:'',  
            box:'',  
            is_empty:'',
            box_belong:'',
            box_type:'',  
            box_type_id:'',    
            number_yu:'',  
            hz_weight:'',  
            bz_weight:'',  
            jf_weight:'',  
            cyr_weight:'', 
            size:'',
      })
    }
    tuoyunList.value = tuData
		tuoyunShow.value = true
}
const handleAddSucc = ()=>{
  addShow.value = false
  crudRef.value.refresh()
}
const handlePipei = ()=>{
  pipeiShow.value = true
  pipeiindexRef.value.open()
}
const handleDaozhan = ()=>{
  daozhanShow.value = true
  daozhanindexRef.value.open()
}
const handleZhuangxie = ()=>{
  zhuangxieShow.value = true
  zhuangxieRef.value.open()
}
const handlecheshi = ()=>{
  let iframe = myIframe.value
  let iframeContent = iframe.contentWindow || iframe.contentDocument
  console.log(iframeContent.document)
}
const handleZhutiaoCel = ()=>{
  onepipeiShow.value = false
  crudRef.value.refresh()
}
const zhangdanshuaxin = ()=>{
  showBill.value = false
  crudRef.value.refresh()
}
const chongGouList = ref([])
const chongGouTotal = ref()
const next = ref(1)
const dept_list = ref([])   //  公司列表
const contract_list = ref([])  // 合同列表
const goods_list = ref([])  // 商品列表
const load_list = ref([
  { name: "无", id: 3 },
  { name: "未完成", id: 2 },
  { name: "已完成", id: 1 },
])
const is_carList = ref([
  { name: "火车", id: 0 },
  { name: "汽车", id: 1 },
])
const loading = ref(false)
const is_emptyList = ref([
  { name: "空箱", id: 1 },
  { name: "重箱", id: 2 },
])
const addObj = ref({
  box: '',
  box_belong: '',
  box_type_id: '',
  car_no: '',
  car_type:'',
  contract_id: '',
  dept_id: '',
  goods_id: '',
  number_yu: '',
  producer: '',
  serve_type: '',
  transport_type: '',
  hz_weight:'',
  bz_weight:'',
  jf_weight:'',
  cyr_weight:'',
  yb_weight: '',
  come_address:'遂宁南',
  ticket_number:'',
  box: '',
  is_empty: '',
})
const handlePipeiSucc = (item)=>{
  pipeiShow.value = false
  Message.success('匹配成功！')
  crudRef.value.refresh();
}
const handledaozhanSucc = (item)=>{
  // daozhanShow.value = false
  Message.success('已确认到站！')
  crudRef.value.refresh();
}
const handlezhuangxieSucc = (item)=>{
  // daozhanShow.value = false
  Message.success('已确认装卸！')
  crudRef.value.refresh();
}

const handleQueRenZhangdan = (row)=>{
  billData.value = row
  showBill.value = true
}

const dpShow = ref(false)
const daShpwloading = ref(false)
const dpUrl = ref([])
const openFile = (id) => {
    // 假设文件URL是http://example.com/file.pdf
    // const fileUrl = 'https://ec.95306.cn/goPdf?aqcnsfileId=' + id;
    let fileUrl = ""
    dpUrl.value = []
    dpShow.value = true
    const queryString = new URLSearchParams({ticket_numbers:id}).toString();
    fetch(`https://pdf.chuangxing.ren/api/index/get_pdf_url?${queryString}`,{
      headers:{
        'Content-Type': 'application/json',
      }
    })
    .then(response => response.json())
    .then(data => {
      if(data.code == 1){
        dpUrl.value = data.data
        daShpwloading.value = true
        setTimeout(() => {
          daShpwloading.value = false
        },1000)
      }else{
        Message.error(data.msg)
        dpShow.value = false
      }
      
    })
    .catch(error => console.error('Error:', error));
    

    
};
const calculationyu = (item) => {
  console.log(item)
  let num = 0
  let weight = 0
  item.map((v, i) => {
    num += v.number_yu
    weight = (v.yb_weight - 0) + weight
  })
  return `${num}件/${weight.toFixed(3)}吨`
}
const calculationsheng = (item) => {
  console.log(item)
  let num = 0
  let weight = 0
  item.map((v, i) => {
    num += v.number
    weight = (v.weight - 0) + weight
  })
  return `${num}件/${weight.toFixed(3)}吨`
}
const calculationyb = (item) => {
  console.log(item)
  let weight = 0
  item.map((v, i) => {
    weight = (v.weight_yu - 0) + weight
  })
  return `${weight.toFixed(3)}吨`
}
const handleFWFSedit = async () => {  // 修改是否仓储
  let res = await predictionManage.changeServeType({ id: fuwuItem.value.id, serve_type: fuwuserve_type.value - 0 })
  if(res.code == 200){
    Message.success('修改成功！')
    crudRef.value.refresh()
    return true
  }else{
    Message.error(res.message)
    return false
  }
  
}

const handlexiugaiFW = (item) => {  // 打开修改是否仓储弹窗
  fuwuItem.value = item
  fuwuserve_type.value = item.serve_type + ''
  console.log('打开是否仓储修改')
  setTimeout(() => {
    xiugaiFWFSShow.value = true
  }, 100);

}

const handleSouSuo = () => {   //搜索
  formObj.value.page = 1
  // handleChongGouList()
  crudRef.value.refresh()
}
const handleChongZhi = () => {   //重置
  formObj.value.page = 1
  formObj.value.pageSize = 10
  formObj.value.dept_id = ''
  formObj.value.contract_id = ''
  formObj.value.goods_ids = ''
  formObj.value.load = ''
  formObj.value.car_no = ''
  formObj.value.box = ''
  formObj.value.box_type = ''
  formObj.value.is_car = ''
  formObj.value.serve_type = ''
  formObj.value.transport_type = ''
  formObj.value.come_time = ''
  formObj.value.created_at = ''
  // handleChongGouList()
  crudRef.value.refresh()
}

const handlecaozuoMb = (row) => {  // 打开操作面板
  tabs.value = 'jc'
  czsjData.value = row
  visiblecaozuoSL.value = true
}
const handleNext = (e) => {
  next.value = e
}
const handleXiugai = (e) => {
  tabs.value = e
}
const handleExpord = () => {   // 导出
  Message.info('请求服务器下载文件中...')
  const data = { page: 1, pageSize: 10 }
  const download = (url) => request({ url, data, method: 'post', timeout: 60 * 1000, responseType: 'blob' })

  download('prediction/manage/export').then(res => {
    tool.download(res)
    Message.success('请求成功，文件开始下载')
  }).catch(() => {
    Message.error('请求服务器错误，下载失败')
  })
}
const buttokLoading = ref(false)
const handleChongGouAdd = () => {
  // addObj.value = {
  //   box: '',
  //   box_belong: '',
  //   box_type_id: '',
  //   car_no: '',
  //   car_type:'',
  //   contract_id: '',
  //   dept_id: '',
  //   goods_id: '',
  //   number_yu: '',
  //   producer: '',
  //   serve_type: '',
  //   transport_type: '',
  //   come_address:'遂宁南',
  //   yb_weight: '',
  //   bz_weight: '',
  //   hz_weight: '',
  //   jf_weight: '',
  //   cyr_weight: '',
  //   ticket_number:'',
  //   box: '',
  //   is_empty: '',
  // }
  itemData.value = {
        car_type:'',  // 车种
        car_no:'',  // 车号
        notice_time:tool.dateFormat(
          Math.round(new Date().getTime() / 1000).toString(),
          "yyyy-MM-dd hh:mm:ss"
        ),  // 通知时间
        transport_type:'1',  // 运输方式
        service_type:'',  //  服务方式
        shipper:'',   // 托运人
        shipper_agent:'',   // 托运经办人
        shipper_phone:'',   // 托运人电话
        sending_station:'',   // 发站
        sending_tlj:'',   // 发 铁路局
        sending_station_special:'',  // 发站专用线
        come_address:'',   // 到站
        come_tlj:'',   // 到 铁路局
        arrive_station_special:'四川威斯腾物流有限公司专用线',  // 到站专用线
        dept_id:'',   // 客户
        customer_handler:'',   // 客户经办人
        customer_tel:'',    // 客户电话
        contract_id:'',   // 合同
        serve_type:'3',   // 是否仓储
        shipping:'',   // 配送电话
        shipping_address:'',   // 配送地址
        goods_data:[],
  }
  addShow.value = true
}
const handleBeforeAdd = () => {
  let obj = JSON.parse(JSON.stringify(addObj.value))
  if (obj.dept_id == '') {
    Message.error('请选择公司')
    return false
  }
  if (obj.contract_id == '') {
    Message.error('请选择合同')
    return false
  }
  if (obj.goods_id == '') {
    Message.error('请选择品名')
    return false
  }
  
  if (obj.car_type == '') {
    Message.error('请选择车种')
    return false
  }
  if (obj.transport_type == '') {
    Message.error('请选择运输方式')
    return false
  }
  if (obj.serve_type == '') {
    Message.error('请选择是否仓储')
    return false
  }
  if (obj.number_yu == '') {
    Message.error('请输入预报件数')
    return false
  }
  
  if (obj.hz_weight == '') {
    Message.error('请输入货重')
    return false
  }
  if (obj.bz_weight == '') {
    Message.error('请输入标重')
    return false
  }
  if (obj.jf_weight == '') {
    Message.error('请输入计费重量')
    return false
  }
  if (obj.cyr_weight == '') {
    Message.error('请输入承运人重量')
    return false
  }
  return true
}
const handleAdd = () => {
  let obj = {}
  for (let key in addObj.value) {
    if (addObj.value[key]) {
      obj[key] = addObj.value[key]
    }
  }
  predictionManage.save(obj).then(res => {
    console.log(res)
    if (res.code == 200) {
      Message.success('新增成功！')
      addShow.value = false
      formObj.value.page = 1
      // handleChongGouList()
      crudRef.value.refresh()
    }else{
      // Message.success(res.message)
    }
  })
}

const handleChongGouPage = (page) => {
  formObj.value.page = page
  crudRef.value.refresh()
  // handleChongGouList()
}
const handleChongGouSizePage = (pageSize) => {
  formObj.value.pageSize = pageSize
  if (formObj.value.page == 1) {
    crudRef.value.refresh()
    // handleChongGouList()
  } else {

  }
}
const handleOkTime = (dateString, date) => {
  formObj.value.come_time = dateString
}
const handleOkTimes = (dateString, date) => {
  formObj.value.created_at = dateString
}
const handleDeptList = () => {   //  获取公司列表
  request({
    url: 'system/dept/index',
    method: 'get',
    data: {
      openPage: false,
      remoteOption: {
        filter: {
          type: ['=', 2],
          status: ["=",1]
        },
        select: ["id", "name"],
        sort: { id: "desc" }
      }
    }
  }).then(res => {
    let arr = []
    res.data.map((v,i)=>{
        v.keywords = [
          v.name,
          pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
          pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
        ]
        if(v.status == 1){
          arr.push(v)
        }
    })
    dept_list.value = arr
  })
}

const hadnleChangeDept = (e) => {
  contract_list.value = []
  addObj.value.contract_id = ''
  formObj.value.contract_id = ''
  addObj.value.goods_id = ''
  formObj.value.goods_id = ''
  handleContract(e)
}

const handleContract = (id) => {
  request({
    url: 'system/userContract/remote_prediction?dept_id=' + id,
    method: 'get',
    params: {
      openPage: false,
    }
  }).then(res => {
    contract_list.value = res.data
  })
}
const hadnleChangeContract = (e) => {
  goods_list.value = []
  addObj.value.goods_id = ''
  formObj.value.goods_id = ''
  request({
      url: 'goods/manage/index',
      method: 'get',
      params:{
          pageSize:1000,
      }
  }).then(res => {
      let _data = res.data.items
      _data.map((v,i)=>{
          v.goods_id = v.id
          // v.name = v.type.name + '-' + v.name
      })
      _data.map((v,i)=>{
        v.keywords = [
          v.name,
          pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
          pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
        ]
      })
      // list = _data
      goods_list.value = _data
  })
  // request({
  //   url: 'system/userContractGoods/remote_prediction?contract_id=' + e,
  //   method: 'get',
  //   params: {
  //     openPage: false,
  //   }
  // }).then(res => {
  //   goods_list.value = res.data
  // })
}


const handleZhangdan = (item) => {
  tabs.value = 'zd'
  czsjData.value = item
  visiblecaozuoSL.value = true
  // orderShowItems.value = true
  // orderShowItem.value = item
}
const handleXiugaiweight = (item) => {
  xiugaiweightShow.value = true;
  xiugaiweightItem.value = item;
};
const handlexiugaiweightShow = () => {
  xiugaiweightShow.value = false;
};
const handlecolse = (e) => {
  next.value = 1
  visibleguoguiSL.value = false;
};
const handlestationCancel = () => {
  crudRef.value.refresh();
  // crudRefJzx.value.refresh();
  formObj.value.page = 1
  // handleChongGouList()
};

const handelStation = (currentRow) => {
  stationRef.value.open(currentRow);
  visiblestation.value = true;
};

const handleprediciont_status = (key, index) => {
  prediciont_status.value = key;
  formObj.value.prediciont_status = key;
  formObj.value.page = 1;
  // handleChongGouList()
  crudRef.value.refresh()

};

const handelys = (e) => { };

const downFromOther = () => {
  // let download = new XMLHttpRequest();
  // download.open("GET", "https://wst-admin.chuangxing.ren/drmb.xlsx", true);
  // download.responseType = "blob";
  // download.onload = function (e) {
  //   var url = window.URL.createObjectURL(download.response);
  //   var a = document.createElement("a");
  //   a.href = url;
  //   a.download = "批量预报导入模版.xlsx";
  //   document.body.appendChild(a);
  //   a.click();
  //   document.body.removeChild(a);
  // };
  // download.send();

  Message.info('请求服务器下载文件中...')
	const data = {page:1,pageSize:10}
	const download = (url) => request({ url, data, method: 'post', timeout: 60 * 1000, responseType: 'blob' })
  
	download('prediction/manage/downloadTemplate').then(res => {
	  tool.download(res)
	  Message.success('请求成功，文件开始下载')
	}).catch(() => {
	  Message.error('请求服务器错误，下载失败')
	})
};

const handelShowUp = () => {
  showUpload.value = true;
  yunshuId.value = "";
  fuwuId.value = "";
  // duijieId.value = "";
  yonghuId.value = "";
  fileList.value = [];
  selectedKeys.value = [];
};

// 巡查记录
const handleLogIndex = (row) => {
  visibleLog.value = true;
  logRef.value.open(row);
};

// 删除
const handleDel = (row) => {
  predictionManage.deletes({ ids: [row.id] }).then((res) => {
    Notification.success(res.message);
    crudRef.value.refresh();
  });
};

// 批量删除
const plDelete = () => {
  console.log(keys)
  if(keys.length == 0){
    Message.error("请选择需要删除的数据");
    return
  }
  predictionManage.deletes({ ids: keys}).then((res) => {
    keys = []
    Notification.success(res.message);
    crudRef.value.refresh();
  });
};

const handleeditShow = async () => {
  editShow.value = false;
};
// 提交编辑
const handleTJedit = async () => {
  let res = await predictionManage.update(rowData.id, rowData)
  if(res.code == 200){
  	Notification.success(res.message);
    editShow.value = false;
    return true
  }else{
    Notification.error(res.message);
    return false
  }
  
};
// 提交修改计费重量
const handleTJXGedit = async () => {
  let object = JSON.parse(JSON.stringify(xiugaiweightItem.value))
  object.weight = object.weight_yu
  let res = await predictionManage.update(xiugaiweightItem.value.id, object)
  if(res.code == 200){
  	Notification.success(res.message);
    crudRef.value.refresh();
    xiugaiweightShow.value = false;
    return true
  }else{
    Notification.error(res.message);
    return false
  }
  
}

const handleEdit = (row) => {
  rowData = row;
  rowData.dept_name = rowData.dept.name
  rowData.transport_type = rowData.transport_type + "";
  rowData.serve_type = rowData.serve_type + "";
  editShow.value = true;
};

const handleTJyuyuan = async () => {
  let res = await predictionManage.zhuangxieUpdata(rowData.id, rowData)
  if(res.code == 200){
    Notification.success(res.message);
    crudRef.value.refresh();
    ruyuanShow.value = false;
    return true
  }else{
    Notification.error(res.message);
    return false
  }
  
};

const handleruyuanShow = () => {
  ruyuanShow.value = false;
};

const handleRuyuan = (row) => {
  rowData = row;
  rowData.dept_name = rowData.dept.name
  ruyuanShow.value = true;
};

// 导入之前处理
const beforeUpload = () => {
  // if (!yunshuId.value || !fuwuId.value || !yonghuId.value) {
  //   Message.error("信息不能为空！");
  //   return false;
  // } else {
  //   return true;
  // }
  return true;
};

// 预报单导入成功
const handleSuccess = (res) => {
  console.log(res)
  if(res.response.code == 200 && res.response.data.length > 0){
    showUpload.value = false;
    showYuji.value = true;
    yujiloading.value = false;
    let _data = res.response.data;
    let arr = [];
    _data.map((v, i) => {
      console.log(v)
      v.id = i + 1;
      if (v.import_status == 0) {
        v.disabled = true;
      } else {
        v.disabled = false;
        arr.push(v.id);
      }
      v.bz_weight = v.bz_weight - 0;
      v.hz_weight = v.hz_weight - 0;
      v.jf_weight = v.jf_weight - 0;
      v.cyr_weight = v.cyr_weight - 0;
      v.number = v.number - 0;
    });
    selectedKeys.value = arr;
    yujiList = _data;
  }else{
    Message.error("数据异常！无数据或格式错误")
  }
  
  // crudRef.value.requestData();
  // crudRefJzx.value.requestData();
};
// 选择的
const handleSelChange = (res) => {
};

const handleYujiCel = () => {
  next.value = 1
  showYuji.value = false;
};

// 成功   导入
const handleYujiSucc = (res) => {
  yujiloading.value = true
  if (selectedKeys.value.length == 0) {
    Message.error("请选择导入的数据");
    yujiloading.value = false
    return true;
  }
  let arr = [];
  yujiList.map((v, i) => {
    selectedKeys.value.map((vv, ii) => {
      if (vv == v.id) {
        arr.push(v);
      }
    });
  });
  predictionManage.importSave(arr).then((res) => {
    console.log(res)
    if (res.code == 200) {
      showYuji.value = false;
      yujiloading.value = false
      crudRef.value.requestData();
      // crudRefJzx.value.requestData();
      // handleChongGouList()
      return Notification.success("导入成功！");
    }else{
      yujiloading.value = false
    }
  }).catch((res) => {
    yujiloading.value = false
  });
};

// 退出到站导入  更新列表
const handleStartEnd = () => {
  crudRef.value.requestData();
  // crudRefJzx.value.requestData();
  // handleChongGouList()
};

const setSelected = (val) => {
  ids = val;
};
const setSelectedKeys = (val) => {
  keys = val;
};
let okloading = false;
const visible = ref(false);
const fdslvisible = ref(false);
const ccvisible = ref(false);
const showUpload = ref(false);
const addressChange = async (row) => {
  let aa = await predictionAddress.getAddressInfo({ id: row });
  addobj.delivery_mobile = aa.data.mobile;
  addobj.delivery_address = aa.data.address;
  addobj.delivery_tel = aa.data.tel;
  addobj.delivery_unit = aa.data.unit;
  addobj.lat = aa.data.lat;
  addobj.lng = aa.data.lng;
}; 

const form = reactive({
  value: "",
});

const boxTypeList = reactive([]);
const yunshuList = reactive([]);
const yunshuId = ref();
const fuwuList = reactive([]);
const fuwuId = ref();
const duijieList = reactive([]);
// const duijieId = ref();
const yonghuList = reactive([]);
const yonghuId = ref();
const isShuaxin = ref(false)
onMounted(() => {
  commonApi.getDict("transport_type").then((res) => {
    yunshuList.value = res.data;
    console.log('yunshuList:', yunshuList.value)
  });
  commonApi.getDict("serve_type").then((res) => {
    fuwuList.value = res.data;
    console.log('fuwuList:', fuwuList.value)
  });
  commonApi.getDict("butt_type").then((res) => {
    duijieList.value = res.data;
  });
  commonApi.getDict("prediciont_status").then((res) => {
    prediciont_statusList.value = [{ title: "全部", key: "" }, ...res.data];
  });
  request({
      url: 'prediction/dfz/index',
      method: 'get',
      params: {
          pageSize: 1000,
      }
  }).then(res => {
      sendList.value = res.data.items
  })
  handleyonghu();
  handleBoxtype();
  handleDeptList();
  hadnleChangeContract()
  setTimeout(() => {
    isShuaxin.value = false
  }, 1000)
});

onActivated(() => {
  if (!isShuaxin.value) {
    crudRef.value.refresh()
    hadnleChangeContract()
  }
})


const handleChongGouList = () => {
  let obj = {}
  for (let key in formObj.value) {
    if (formObj.value[key]) {
      obj[key] = formObj.value[key]
    }
  }
  loading.value = true
  chongGouList.value = []
  predictionManage.getList(obj).then(res => {
    if (res.code == 200) {
      loading.value = false
      let _data = res.data.items
      _data.map((v, i) => {
        if (v.prediciont_status == 0 ) {
          v.disabled = false;
        } else {
          v.disabled = true;
        }
        if (v.load_detail == null) {   // 未生成装卸任务
          v.load = 3
        } else if (v.load_detail.detail_load_status == 0) { // 已生成装卸任务
          v.load = 2
        } else if (v.load_detail.detail_load_status == 1) { // 已生成装卸任务
          v.load = 1
        }
        v.weight = (v.weight - 0).toFixed(3);
        v.weight_yu = (v.weight_yu - 0).toFixed(3);
        v.yb_weight = (v.yb_weight - 0).toFixed(3);
        v.goods_ids = v.goods_id
      });
      chongGouList.value = _data
    }
    chongGouTotal.value = res.data.pageInfo.total
  })
}

const handleBoxtype = () => {
  request({
    url: "prediction/boxManage/index",
    method: "get",
    params: {
      openPage: false,
    },
  }).then((res) => {
    boxTypeList.value = res.data.items;

  });
}

const handleyonghu = () => {
  request({
    url: "system/dept/remote",
    method: "post",
    data: {
      openPage: false,
      remoteOption: {
        filter: { type: ["=", 2],status: ['=',1] },
        relations: [],
        select: ["id", "name"],
        sort: { id: "desc" },
      },
    },
  }).then((res) => {
    yonghuList.value = res.data;
  });
};

const numberOperation = (newValue, id, numberName) => {
  predictionManage
    .numberOperation({ id, numberName, numberValue: newValue })
    .then((res) => {
      res.success && Message.success(res.message);
    })
    .catch((e) => {
      console.log(e);
    });
};

const switchStatus = (statusValue, id, statusName) => {
  predictionManage
    .changeStatus({ id, statusName, statusValue })
    .then((res) => {
      res.success && Message.success(res.message);
    })
    .catch((e) => { });
};
// 分单受理
const setFdsl = (row) => {
  visibleguoguiSL.value = true;
  setTimeout(() => {
    guoguiSLRef.value.open(row);
  }, 200);

};
// 仓储受理
const setFdcc = (row) => {
  visiblecangcuSL.value = true;
  cangcuSLRef.value.open(row);
};

const handletab = (index) => {
  tab = index;
  prediciont_status.value = "";
};

const handleShow = () => {
  showUpload.value = false;
};

const handleCancel = () => {
  visible.value = false;
};

const handlefdslCancel = () => {
  fdslvisible.value = false;
};
const handleccCancel = () => {
  ccvisible.value = false;
};

const itemTotal = ref({})

const options = reactive({
  id: "flyos_prediction_manage",
  rowSelection: {
			showCheckedAll: true,
		},
  pk: "id",
  bordered: { cell: true },
  showSummary: true,
  summary: [
      // 定义 amountA 字段加总合计
      {
          dataIndex: 'number_yu',
          action: 'sum'
      },
      {
          dataIndex: 'hz_weight',
          action: 'sum'
      },
      {
          dataIndex: 'bz_weight',
          action: 'sum'
      },
      {
          dataIndex: 'jf_weight',
          action: 'sum'
      },
      {
          dataIndex: 'cyr_weight',
          action: 'sum'
      },
      {
          dataIndex: 'number',
          action: 'sum'
      },
      {
          dataIndex: 'numbers',
          action: 'sum'
      },
      {
          dataIndex: 'weights',
          action: 'sum'
      },
  ],
  // bordered:true,
  operationColumn: true,
  operationWidth: 400,
  operationColumnAlign:'center',
  operationColumnWidth: 300,
  api: predictionManage.getList,
  recycleApi: predictionManage.getRecycleList,
  // 新增预报功能，使用的crud组件中的新增功能
  add: {
    show: false,
    api: predictionManage.save,
    text: "新增预报",
    auth: ["prediction:manage:save"],
  },
  edit: {
    show: false,
    api: predictionManage.update,
    auth: ["prediction:manage:update"],
  },
  delete: {
    show: false,
    api: predictionManage.deletes,
    auth: ["prediction:manage:delete"],
    realApi: predictionManage.realDeletes,
    realAuth: ["prediction:manage:realDeletes"],
  },
  recovery: {
    show: false,
    api: predictionManage.recoverys,
    auth: ["prediction:manage:recovery"],
  },
  import: {
    show: false,
    url: "prediction/manage/import",
    templateUrl: "prediction/manage/downloadTemplate",
    auth: ["prediction:manage:import"],
  },
  export: {
    show: true,
    url: "prediction/manage/export",
    auth: ["prediction:manage:export"],
  },
  beforeRequest: (params) => {
    params.prediciont_status = formObj.value.prediciont_status
    params.type = 1
    params.is_hebing = 2
    let obj = JSON.parse(JSON.stringify(params))
    obj.is_hebing = ""
    predictionManage.getManageTotal(obj).then(res => {
      itemTotal.value = res.data.total
    })
  },
  beforeImport: (params) => {
    
  },
  afterRequest: (params) => {
    keys = []
    
    console.log(params)
    params.map((v, i) => {
      v.numbers = (v.numbers - 0)
      v.weights = (v.weights - 0)
      if (v.load_detail == null) {   // 未生成装卸任务
        v.load = 3
      } else if (v.load_detail.detail_load_status == 0) { // 已生成装卸任务
        v.load = 2
      } else if (v.load_detail.detail_load_status == 1) { // 已生成装卸任务 
        v.load = 1 
      }

      if(v.goods_data !== null){
        if (typeof v.goods_data === 'object' && Array.isArray(v.goods_data)) {
            
        } else if (typeof v.goods_data === 'object' && !Array.isArray(v.goods_data)) {
          v.goods_data = [{...v.goods_data}];
        }
      }else{
        v.goods_data = []
      }

      v.number_yu = (v.number_yus - 0);
      v.weight = (v.weight - 0).toFixed(3);
      v.weight_yu = (v.weight_yus - 0).toFixed(3);
      v.yb_weight = (v.yb_weight - 0).toFixed(3);
      v.goods_ids = v.goods_id
      v.bz_weight = (v.bz_weights - 0).toFixed(3)
      v.cyr_weight = (v.cyr_weights - 0).toFixed(3)
      v.hz_weight = (v.hz_weights - 0).toFixed(3)
      v.jf_weight = (v.jf_weights - 0).toFixed(3)
      if(v.pay_order.length == 0){
        v.is_compled = 0
        v.pay_order_price = 0
      }else{
        let num = v.pay_order.findIndex(item=>{
          return item.is_confirm == 0
        })
        if(num != -1){
          v.is_compled = 0
        }else{
          v.is_compled = 1
        }
        let price = 0
        v.pay_order.map((vv,ii)=>{
          price += (vv.pay_real_price - 0)
        })
        v.pay_order_price = price.toFixed(2)
      }
      if (v.prediciont_status == 0 && v.is_nobody == 0 && v.is_compled == 0) {
        v.disabled = false;
      } else {
        v.disabled = true;
      }
    });
    
  },
  beforeDelete:(params)=>{
  	console.log(params)
  },
  afterDelete:(params)=>{
  	keys = []
  },
  beforeSearch: (params) => {
    console.log('搜索前：', params)
    if (params.goods_ids) {
      params.goods_id = params.goods_ids
    } else {
      params.goods_id = ''
    }
  }
});

const columns = reactive([
  {
    title: "ID",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入ID",
    },
  },
  {
    title: "运单号",
    dataIndex: "yundanhao",
    align: "center",
    formType: "input",
    search: true,
    addDisplay: false,
    editDisplay: false,
    commonRules: {
      // required: true,
      message: "请输入运单号",
    },
  },
  
  {
    title: "到达时间",
    dataIndex: "come_time",
    formType: "range",
    width: 180,
    align: "center",
    search: true,
    addDisplay: false,
    editDisplay: false,
    sortable: {
      sortDirections: ["ascend", "descend"],
      sorter: true,
    },
    showTime: true,
  },
  {
    title: "原票号",
    dataIndex: "ticket_number",
    align: "center",
    formType: "input",
    search: true,
    width: 180,
    addDisplay: false,
    editDisplay: false,
    commonRules: {
      // required: true,
      message: "请输入原票号",
    },
  },
  {
    title: "车箱号",
    dataIndex: "car_no",
    align: "center",
    formType: "input",
    width: 180,
    search: true,
  },
  {
    title: "集装箱号",
    dataIndex: "box",
    align: "center",
    formType: "input",
    width: 180,
    search: true,
    hide:true
  },
  {
    title: "运输方式",
    dataIndex: "transport_type",
    formType: "select",
    align: "center",
    search: true,
    dict: {
      name: "transport_type",
      props: {
        label: "title",
        value: "key",
      },
      translation: true,
    },
  },
  {
    title: "发站 - 到站",
    dataIndex: "producer",
    align: "center",
    formType: "input",
    search: false,
  },
  {
    title: "运单状态",
    dataIndex: "prediciont_status",
    formType: "select",
    align: "center",
    search: false,
    addDisplay: false,
    editDisplay: false,
    dict: {
      name: "prediciont_status",
      props: {
        label: "title",
        value: "key",
      },
      translation: true,
    },
  },
  {
    title: "客户",
    dataIndex: "dept_id",
    align: "center",
    formType: "select",
    width: 180,
    search: true,
    dict: {
      // 远程通用接口请求，新版代码生成都有一个 remote 接口
      remote: "system/dept/remote",
      // 指定组件接收的props
      props: { label: "name", value: "id" },
      // 开启分页
      openPage: false,
      // 远程请求配置项
      remoteOption: {
        // 按用户名排序
        sort: { id: "desc" }, // 如果不指定排序方式，默认为正序排序
        // 设置查询的字段
        select: ["id", "name"],
        // 设置数据过滤
        filter: {
          type: ["=", 2],
          status: ['=',1]
        },
        // 关联模型
        relations: [],
        translation: true
      },
    },
    cascaderItem: ["contract_id"],
  },
  {
    title: "合同号",
    dataIndex: "contract_id",
    align: "center",
    formType: "select",
    width: 180,
    search: true,
    dict: {
      url: "system/userContract/remote_prediction?dept_id={{key}}",
      props: { label: "contract_no", value: "id" },
    },
    commonRules: {
      required: true,
      message: "请选择合同号",
    },
    cascaderItem: ["goods_id"],
  },
  {
    title: "品名",
    dataIndex: "goods_id",
    formType: "select",
    align: "center",
    search: false,
    addDisplay: true,
    editDisplay: true,
    dict: {
      url: "system/userContractGoods/remote_prediction?contract_id={{key}}",
      props: { label: "name", value: "goods_id" },
      cache: true,
    },
    commonRules: {
      required: true,
      message: "请选择品名",
    },
    control: (val, item) => {
      console.log(crudRef.value.crudFormRef);
    },
  },
  {
    title: "品名",
    dataIndex: "goods_ids",
    formType: "select",
    align: "center",
    width: 160,
    search: true,
    addDisplay: false,
    editDisplay: false,
    hide: true,
    dict: {
      url: "goods/manage/index",
      params: {
        page: 1,
        pageSize: 500
      },
      props: { label: "name", value: "id" },
    },
    commonRules: {
      required: true,
      message: "请选择品名",
    },
  },
  {
    title: "支付状态",
    dataIndex: "prediction_pay_status",
    formType: "select",
    align: "center",
    search: false,
    addDisplay: false,
    editDisplay: false,
    dict: {
      name: "prediction_pay_status",
      props: {
        label: "title",
        value: "key",
      },
      translation: true,
    },
  },
  {
    title: "通知时间",
    dataIndex: "notice_time",
    formType: "range",
    width: 180,
    align: "center",
    search: true,
    addDisplay: false,
    editDisplay: false,
    sortable: {
      sortDirections: ["ascend", "descend"],
      sorter: true,
    },
    showTime: true,
  },
  
  
  
  {
    title: "到站类型",
    dataIndex: "is_car",
    align: "center",
    formType: "select",
    search: false,
    dict: {
      data(){
          return [
              { label: "火车", value: 0 },
              { label: "汽车", value: 1 },
          ]
      },
      translation: true,
    },
  },
  {
    title: "剩余件数/重量",
    dataIndex: "number",
    formType: "input",
    align: "center",
    addDisplay: false,
    // search: true
  },
  
  {
    title: "件数（件）",
    dataIndex: "number_yu",
    formType: "input",
    align: "center",
    // search: true
  },
  {
    title: "货重（吨）",
    dataIndex: "hz_weight",
    formType: "input",
    align: "center",
    // search: true
  },
  {
    title: "标重（吨）",
    dataIndex: "bz_weight",
    formType: "input",
    align: "center",
    // search: true
  },
  {
    title: "计费重量（吨）",
    dataIndex: "jf_weight",
    formType: "input",
    align: "center",
    // search: true
  },
  {
    title: "承运人重量（吨）",
    dataIndex: "cyr_weight",
    formType: "input",
    align: "center",
    // search: true
  },
  {
    title: "办理时间",
    dataIndex: "process_time",
    formType: "range",
    width: 180,
    align: "center",
    addDisplay: false,
    editDisplay: false,
    sortable: {
      sortDirections: ["ascend", "descend"],
      sorter: true,
    },
    showTime: true,
  },
  
  
  
  
  
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "range",
    align: "center",
    width: 180,
    search: true,
    addDisplay: false,
    editDisplay: false,
    sortable: {
      sortDirections: ["ascend", "descend"],
      sorter: true,
    },
    showTime: true,
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    align: "center",
    editDisplay: false,
    hide: true,
    showTime: true,
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    align: "center",
    editDisplay: false,
    hide: true,
    showTime: true,
  },
  {
    title: "创建人",
    dataIndex: "created_by",
    align: "center",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
  },
  {
    title: "修改人",
    dataIndex: "updated_by",
    align: "center",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
  },
]);


const columnsEpor = reactive([
  {
    title: "通知时间",
    dataIndex: "notice_time",
    align: "center",
    ellipsis: true,
    fixed: "left",
    width:140,
    tooltip: true,
  },
  {
    title: "客户名称",
    dataIndex: "dept_name",
    align: "center",
    ellipsis: true,
    fixed: "left",
    width:140,
    tooltip: true,
  },
  {
    title: "原票号",
    dataIndex: "ticket_number",
    align: "center",
    ellipsis: true,
    width:140,
    tooltip: true,
  },
  {
    title: "车种",
    dataIndex: "car_type",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "车号",
    dataIndex: "car_no",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "箱号",
    dataIndex: "box",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "箱型箱类",
    dataIndex: "box_type",
    align: "center",
    ellipsis: true,
    width:140,
    tooltip: true,
  },
  {
    title: "空重状态",
    dataIndex: "is_empty",
    align: "center",
    ellipsis: true,
    tooltip: true,
    width:100,
    slotName: 'is_empty',
  },
  {
    title: "箱属",
    dataIndex: "box_belong",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
    slotName: 'box_belong'
  },
  {
    title: "运输方式",
    dataIndex: "transport_type",
    align: "center",
    ellipsis: true,
    tooltip: true,
    width:100,
    slotName: 'transport_type',
  },
  {
    title: "发站",
    dataIndex: "sending_station",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
    slotName: 'sending_station',
  },
  {
    title: "到站",
    dataIndex: "come_address",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
    slotName: 'come_address',
  },
  {
    title: "品名",
    dataIndex: "goods_name",
    align: "center",
    ellipsis: true,
    width:140,
    tooltip: true,
  },
  {
    title: "件数",
    dataIndex: "number",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "标重(吨)",
    dataIndex: "bz_weight",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "货重(吨)",
    dataIndex: "hz_weight",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "计费重量(吨)",
    dataIndex: "jf_weight",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "承运人重量(吨)",
    dataIndex: "cyr_weight",
    align: "center",
    ellipsis: true,
    tooltip: true,
    width:140,
  },
  {
    title: "合同号",
    dataIndex: "contract_no",
    align: "center",
    ellipsis: true,
    width:140,
    tooltip: true,
    slotName: 'contract_id',
  },
  {
    title: "服务方式",
    dataIndex: "service_type",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
    slotName: 'service_type',
  },
  {
    title: "托运人",
    dataIndex: "shipper",
    align: "center",
    width:100,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: "托运经办人",
    dataIndex: "shipper_agent",
    align: "center",
    width:100,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: "托运电话",
    dataIndex: "shipper_phone",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "发站专用线",
    dataIndex: "sending_station_special",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "包装",
    dataIndex: "baozhuang",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },
  {
    title: "体积",
    dataIndex: "size",
    align: "center",
    ellipsis: true,
    width:100,
    tooltip: true,
  },

  {
    title: "配送地址",
    dataIndex: "address",
    align: "center",
    ellipsis: true,
    width:140,
    tooltip: true,
  },
  {
    title: "备注",
    dataIndex: "remark",
    align: "center",
    ellipsis: true,
    fixed: "right",
    width:180,
    tooltip: true,
    cellStyle:{color:'red'}
  },
]);
</script>
<style lang="less" scoped>
.input {
  width: 100px;
  padding: 4px 12px;
  background: rgba(242, 243, 245);
  border: 1px solid rgba(242, 243, 245);
  border-radius: 4px;
  outline: none;
  /*清除input点击之后的黑色边框*/
}

.input:focus {
  background: #fff;
  border: 1px solid #1e80ff;
}

.yphbox {
  display: flex;
  justify-content: center;
  height: 165px;
}

.yphbox .arco-upload-wrapper {
  width: 100%;
}

// .arco-upload-wrapper {
//   width: 50%;
// }

.tableCentant {
  padding-top: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, .15);

  &:last-child {
    border-bottom: none;
  }
}

.biaoshen {
  -ms-overflow-style: none;
  /* IE 10+ */
  scrollbar-width: none;
  /* Firefox */
}

.biaoshen::-webkit-scrollbar {
  display: none;
}
</style>
<script>
export default { name: "prediction:manage" };
</script>
